# SETTINGS
$fileName = "Globsite.Globalization.Mvc.dll"
$sourceFolder = "..\Mvc\bin\NuGet-net45\"
$targetFolder = ".\lib\net45\"
$nuGetPath = "..\Solution Items\Tools\NuGet.exe"


# Copy the assembly file from a source project. Replace old one if exists.
Write-Host "`r`n***** Copying assembly... *****" -ForegroundColor Yellow
Try
{
	Copy-Item -Path "$($sourceFolder)$($fileName)" -Destination $targetFolder -Force
}
Catch
{
	Write-Host "***** Copying failed *****" -ForegroundColor Red
    Write-Host "`r`n***** Press Enter to exit *****" -ForegroundColor Yellow
    Read-Host
    Break
}

# Create a NuGet package specification from the assembly file. Replace old one if exists.
Write-Host "`r`n***** Creating specification... *****`r`n" -ForegroundColor Yellow
Try
{
	Start-Process -NoNewWindow -Wait -FilePath $nuGetPath -ArgumentList "spec -AssemblyPath $($targetFolder)$($fileName) -Verbosity detailed"
}
Catch
{
    Write-Host "***** Creating specification failed *****" -ForegroundColor Red
    Write-Host "`r`n***** Press Enter to exit *****" -ForegroundColor Yellow
    Read-Host
    Break
}

# Prevent for closing the window.
Write-Host "`r`n***** Press Enter to exit *****" -ForegroundColor Yellow
Read-Host